﻿/// <reference path="../GeneratedArtifacts/viewModel.js" />
/// <reference path="../Scripts/itgLsEnhancedTable.js" />


myapp.AnimalsEnhancedTable.Animal_postRender = function (element, contentItem) {

  // Store our enhanced table as part of our contentItem so we can get at it later
  contentItem.enhancedTable = new itgLs.EnhancedTable({
      element: element,
      contentItem: contentItem
  });

};
myapp.AnimalsEnhancedTable.ClearAll_execute = function (screen) {

  // Get our table
  var table = screen.findContentItem("Animal").enhancedTable;

  // Clear all the sorts and filters
  table.clearAll();

  // If we are not in batch mode, reQuery
  if (!table.getBatchMode()) table.reQuery();

};
myapp.AnimalsEnhancedTable.ExecuteBatch_execute = function (screen) {

  // Get our table
  var table = screen.findContentItem("Animal").enhancedTable;

  // Execute the sort/filter settings
  table.reQuery();

};
myapp.AnimalsEnhancedTable.ToggleBatch_execute = function (screen) {

  // Get our table
  var table = screen.findContentItem("Animal").enhancedTable;

  // Toggle batch mode
  table.setBatchMode(!table.getBatchMode());

};
myapp.AnimalsEnhancedTable.SetColumnFilter_postRender = function (element, contentItem) {

  // Check mark icon, keep text at the bottom
  itgLs.ui.convertToIconicButton(element, contentItem, "accept");

};
myapp.AnimalsEnhancedTable.ClearColumnFilter_postRender = function (element, contentItem) {

  // Minus mark icon, keep text at the bottom
  itgLs.ui.convertToIconicButton(element, contentItem, "remove");

};
myapp.AnimalsEnhancedTable.SetColumnFilter_execute = function (screen) {

  // Get our table
  var table = screen.findContentItem("Animal").enhancedTable;

  // Call our set filter function for this column only
  table.setColumnFilter();

  // Close the popup
  table.closeFilterPopup();

};
myapp.AnimalsEnhancedTable.ClearColumnFilter_execute = function (screen) {

  // Get our table
  var table = screen.findContentItem("Animal").enhancedTable;

  // Call our set filter function for this column only
  table.clearColumnFilter();

  // Close the popup
  table.closeFilterPopup();

};